var t = require;
var e = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("BootConst"),
    i = t("EventData"),
    s = t("GameData"),
    c = t("Util"),
    l = t("View"),
    u = t("Platforms"),
    p = t("Sounds"),
    f = t("fun"),
    d = require("./仓库属性战斗力变化飘字"),
    h = cc._decorator,
    y = h.ccclass,
    g =
    (h.property,
        (function(t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "equipbuy"), (e.isMask = !0), (e.zIndex = 2), (e.data = new i.default(null)), e;
            }
            var o;
            return (
                n(e, t),
                (o = e),
                (e.prototype.onEnable = function() {
                    Adv_skd.default.instance.showInterstitialAd();
                    this.data.value = o.data;
                }),
                (e.prototype.view_icon = function(t, e) {
                    t.url.value = e.iconName;
                }),
                (e.prototype.view_money = function(t, e) {
                    t.set(e.Type, e.Need);
                }),
                (e.prototype.view_name = function(t, e) {
                    t.string = e.Name;
                }),
                (e.prototype.view_par1 = function(t, e) {
                    t.string = "攻击力: +" + e.attack;
                }),
                (e.prototype.view_par2 = function(t, e) {
                    t.string = "防御力: +" + e.defense;
                }),
                (e.prototype.view_par3 = function(t, e) {
                    t.string = "生命值: +" + e.HP;
                }),
                (e.prototype.onClick = function(t) {
                    var e = this;
                    switch (t) {
                        case "close":
                            this.hideView();
                            break;
                        case "确认购买":
                            var o = this.data.value,
                                n = Math.floor((o.ID - 12e7) / 10) + 112e6;
                            d.default.变化前属性(n),
                                c.pay(o.Type, o.Need, "装备购买", this, function() {
                                    s.default.equips.push(o.ID),
                                        (s.default.equips = s.default.equips),
                                        e.hideView(),
                                        d.default.变化后属性(n),
                                        u.default.platformCtrl.dd(a.dd.UnlockEquip, {
                                            CostType: o.Type,
                                            CostNeed: o.Need,
                                            eventTime: Date.now(),
                                            Coins: s.default.jb,
                                            Diamonds: s.default.zs,
                                            EquipID: o.ID,
                                            HeroLV: f.getHeroLv(n),
                                            HeroID: n
                                        }),
                                        p.Sounds.playFX("零件解锁");
                                });
                            break;
                        case "再看看":
                            this.hideView();
                    }
                }),
                (e = o = r([y], e))
            );
        })(l.default));
o.default = g;